package com.ideal.frame.node.controller;

import com.ideal.frame.common.dto.ResponseModel;
import com.ideal.frame.node.service.HeartbeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Auther: liudingsheng
 * @Date: 2021/8/27
 * @Description:
 */
@RestController
@RequestMapping("/heartBeat")
public class HeartbeatController {

    @Autowired
    private HeartbeatService heartbeatService;


    @GetMapping("/getLastDayHearts/{nodeId}")
    public ResponseModel getLastDayHearts(@PathVariable String nodeId) {
        return ResponseModel.success(heartbeatService.getLastDayHearts(nodeId));
    }

    @GetMapping("/getHeartsSchedule/{nodeId}/{lastDate}")
    public ResponseModel getHeartsSchedule(@PathVariable String nodeId,@PathVariable Date lastDate) {
        return ResponseModel.success(heartbeatService.getHeartsSchedule(nodeId,lastDate));
    }


}
